
import Person from "./person.js";

module.exports = class Teacher extends Person{
    constructor(name ,age ,klass){
        super(name ,age);
        this.klass = klass;
    }
    introduce(){
        if(this.klass == null){
            return `${super.introduce()} I am a Teacher. I teach No Class.`;            
        }
        else{
            return `${super.introduce()} I am a Teacher. I teach Class ${this.klass.number}.`;                    
        }
    }
    introduceWith(student){
        if(this.klass.number == student.klass.number){
            return `My name is ${this.name}. I am ${this.age} years old. I am a Teacher. I teach ${student.name}.`;
        }
        else{
            return `My name is ${this.name}. I am ${this.age} years old. I am a Teacher. I don't teach ${student.name}.`;
        }
    }

}



